// Pistol (Doom)

ACTOR IDMPistol : IDMWeapon // Doesn't replace 'Pistol' because of such little ammo it provides.
{
	Weapon.SelectionOrder 1000
	Weapon.Sisterweapon "DualPistol"
	// ^ If the upgraded variant of the weapon is a separate actor, the regular weapon needs a Sister weapon.
	//Weapon.PreferredSkin "PistolMarine" // The player skin used by the weapon in 'Skins.wad' when selected.
	Weapon.AmmoUse 1
	Weapon.AmmoGive 20
	Weapon.AmmoType "IDMClip"
	Obituary "%o was gunslinged by %k's Pistol."
	Inventory.Pickupmessage "Pistol! (Slot 2)"
	Tag "Pistol"
	Decal BulletChip
	Damagetype "Bullet"
	AttackSound "weapons/pistol"
	+WEAPON.ALLOW_WITH_RESPAWN_INVUL // All Starting weapons allow respawn protection.
    +INVENTORY.IGNORESKILL // Fixes the ammo given by the pistol pickup.
	+WEAPON.NOLMS
	// ^ Weapon will not be in inventory in Last Man Standing, but can be selected as an additional weapon.
	States
	{
	Ready:
      PISG A 1 A_WeaponReady
      Loop
	Deselect:
      TNT1 A 0 A_Lower
      TNT1 A 0 A_Lower
      PISG A 1 A_Lower
	  Loop
	Select:
	  TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
	Sloop:
      TNT1 A 0 A_Raise
      TNT1 A 0 A_Raise
      PISG A 1 A_Raise
	  Loop
    Fire:
	  TNT1 A 0 A_JumpIfInventory("DuelItem",1,"DuelFire")
      TNT1 A 0 A_JumpIfInventory("PowerQuadDamage", 1, "Quad")
	  TNT1 A 0 A_FireBullets(2.8, 1.775, 1, 25, "IDMBulletPuff")
	  Goto FireEnd
	Quad:
	  TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5,1)
	  TNT1 A 0 A_FireBullets(2.8, 1.775, 1, 25, "ExtremePuff")
	FireEnd:
	  PISG B 4 A_GunFlash
	  PISG C 3
	  PISG A 2
	  PISG A 3 A_Refire
	  Goto Ready
	DuelFire:
      TNT1 A 0 A_JumpIfInventory("PowerQuadDamage", 1, "DuelQuad")
	  TNT1 A 0 A_FireBullets(2.8, 1.775, 1, 20, "IDMBulletPuff")
	  Goto FireEnd
	DuelQuad:
	  TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5,1)
	  TNT1 A 0 A_FireBullets(2.8, 1.775, 1, 20, "ExtremePuff")
	  Goto FireEnd
	Flash:
      PISF A 4 Bright A_Light1
      Goto LightDone
    Spawn:
      PIST A -1 Bright
      Stop
	}
}

ACTOR DualPistol : IDMPistol
{
	+POWERED_UP
	+WEAPON.CHEATNOTWEAPON
	Weapon.Sisterweapon "IDMPistol"
	//Weapon.PreferredSkin "DualPistolMarine"
	Damagetype "Bullet"
	States
	{
	Ready:
      DPIS A 1 A_WeaponReady
      Loop
	Deselect:
      TNT1 A 0 A_Lower
      TNT1 A 0 A_Lower
      DPIS A 1 A_Lower
      Loop
	Select:
	  TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
	Sloop:
      TNT1 A 0 A_Raise
      TNT1 A 0 A_Raise
      DPIS A 1 A_Raise
      Loop
	Fire:
	  DPIS A 1
      TNT1 A 0 A_JumpIfInventory("PowerQuadDamage", 1, "Quad")
	  TNT1 A 0 A_FireBullets(4.2, 1.775, 1, 25, "IDMBulletPuff")
	  TNT1 A 0 A_GunFlash
      DPIS B 3 
      DPIS C 2
	  Goto Normal2
	Quad:
	  TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5,1)
	  TNT1 A 0 A_FireBullets(4.2, 1.775, 1, 25, "ExtremePuff")
	  TNT1 A 0 A_GunFlash
      DPIS B 3 
      DPIS C 2
	Normal2:
      TNT1 A 0 A_JumpIfInventory("PowerQuadDamage", 1, "Quad2")
	  DPIS A 1 A_CheckReload
	  TNT1 A 0 A_FireBullets(4.2, 1.775, 1, 25, "IDMBulletPuff")
	  TNT1 A 0 A_GunFlash("Flash2")
	  DPIS D 3
      DPIS E 2
      DPIS A 5 A_ReFire
	  Goto Ready
	Quad2:
	  TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5,1)
	  DPIS A 1 A_CheckReload
	  TNT1 A 0 A_FireBullets(4.2, 1.775, 1, 25, "ExtremePuff")
	  TNT1 A 0 A_GunFlash("Flash2")
      DPIS D 3
      DPIS E 2
	  TNT1 A 0 A_ReFire
      Goto Ready
	Flash:
      DPIS F 3 Bright A_Light1
      Goto LightDone
	Flash2:
      DPIS G 3 Bright A_Light1
      Goto LightDone
	Spawn:
      PIST A -1 Bright
      Stop
	}
}